
cmake_minimum_required(VERSION 2.8)

#--- имя проекта совпадает с именем каталога проекта
get_filename_component(PROJECT_NAME ${CMAKE_CURRENT_SOURCE_DIR} NAME)

#--- имя главной цели. CXX значает, что проект на с++
project( ${PROJECT_NAME} CXX )

#------------------ библиотеки буста-----------------------------------------------------------------
set(BOOST_COMPONENTS system filesystem regex)

#----- настройки компиляции
include (${CMAKE_CURRENT_SOURCE_DIR}/cmake/setup.cmake)

#------------------ исходные файлы продукта ----------------------------------------------------------

file (GLOB _hpp "include/${PROJECT_NAME}/*.h"   )
file (GLOB _cpp "src/*.cpp" )

set (PRODUCT_SOURCES_FILES ${_hpp} ${_cpp} )
source_group(\\ FILES ${PRODUCT_SOURCES_FILES} )

#------------------ модифицируем имя проекта согласно тэгам конфигурации------------------------------
set(PROJECT_NAME ${PROJECT_NAME}-${ADDRESS_MODEL}${MY_DEBUG_MARKER})

#------------------ пути к хэдерам -------------------------------------------------------------------
set (PATH_INCLUDES
    ${CMAKE_CURRENT_SOURCE_DIR}/include 
    ${Boost_INCLUDE_DIRS} 
)
#------------------ пути к библиотекам -------------------------------------------------------------------
set (PATH_LIB  ${Boost_LIBRARY_DIRS}   )

#------------------ имена библиотек ----------------------------------------------------------------------
if ( ${CMAKE_BUILD_TYPE} MATCHES "Debug" OR ${CMAKE_BUILD_TYPE} MATCHES "debug")
    set(LIBRARIES ${Boost_REGEX_LIBRARY_DEBUG} ${Boost_SYSTEM_LIBRARY_DEBUG} ${Boost_FILESYSTEM_LIBRARY_DEBUG} )
else()
    set(LIBRARIES ${Boost_REGEX_LIBRARY_RELEASE} ${Boost_SYSTEM_LIBRARY_RELEASE} ${Boost_FILESYSTEM_LIBRARY_RELEASE} )
endif()

#----------------------------------------------
include_directories( ${PATH_INCLUDES} )
link_directories   ( ${PATH_LIB}      )

message(STATUS "============================================================" )
view_console("caption:BOOST FOUND"  ${BOOST_ROOT} )
view_console("caption:LIBRARY_DIRS" ${PATH_LIB} )
view_console("caption:INCLUDE_DIRS" ${PATH_INCLUDES} )
view_console("caption:LIBRARIES"    ${LIBRARIES} )
message(STATUS "============================================================" )
#----------------------------------------------------------------------------
add_library (${PROJECT_NAME}  STATIC ${PRODUCT_SOURCES_FILES} )

#get_target_property(COMPILE_FLAGS ${PROJECT_NAME} cxx_flags)

#view_console("caption:get_target_property"    ${cxx_flags} )

set(file_pdb ${CMAKE_BUILD_TYPE}/${PROJECT_NAME}.pdb )

set_target_properties(${PROJECT_NAME}
    PROPERTIES
    COMPILE_FLAGS "/Fd\"${file_pdb}\""
) 

#add_custom_target(combined ALL COMMAND lib /out:combined.lib  ${LIBRARIES}  $<TARGET_FILE:${PROJECT_NAME}> )
